Questions
7 of 30
1What is the purpose of the transform property in CSS?
2What are the different types of CSS transformations?
3What does transform: translate() do?
4What is the difference between translateX() and translateY()?
5How does rotate() work in CSS?
6What is the unit used in rotation?
7What is the difference between scale() and scaleX(), scaleY()?
8What happens when you use negative values in scale()?
9What does the skew() function do?
10Can you combine multiple transform functions together? How? What is the use of the transform-origin property?
11What is the default transform-origin value?
12How does changing transform-origin affect rotation or scaling?
13What is the difference between translate() and using position or margin for movement?
14What is the difference between 2D and 3D transformations?
15What is the difference between 2D and 3D transformations?
16How do you apply a 3D rotation using CSS?
17How do you apply a 3D rotation using CSS?
18What are perspective and perspective-origin in 3D transforms? What is the purpose of transform-style: preserve-3d?
19What is the use of matrix() in CSS transforms?
20What’s the difference between matrix() and matrix3d()?
21How can you center an element using transform and translate()?
22What is the transition property in CSS used for?
23What are the four main components of a transition?
24What does transition-duration specify?
25What are the common timing function values (e.g., ease, linear, ease-in)?
26What is the shorthand syntax for transition?
27Can multiple CSS properties be transitioned simultaneously? How does transition differ from animation in CSS?
28Can you apply a transition to an element’s pseudo-class (like :hover)?
29Can transitions be triggered by JavaScript?
30What happens if transition-duration is set to 0s?
07 / 30

What is the difference between scale() and scaleX(), scaleY()?

Understanding scale(), scaleX(), and scaleY() in CSS

The scale() function in CSS is used to resize elements by scaling them up or down along one or both axes. It is part of the transform property and allows you to control the size of an element without affecting its layout or document flow.

Differences Between scale(), scaleX(), and scaleY()
  1. 1

    scale(x, y) — scales an element horizontally (X-axis) and vertically (Y-axis). If only one value is provided, it scales both axes equally.

  2. 2

    scaleX(x) — scales the element only along the X-axis (width).

  3. 3

    scaleY(y) — scales the element only along the Y-axis (height).

Example: Using Different Scale Functions

In this example, scale(1.5) enlarges the entire box uniformly, scaleX(2) stretches it horizontally, and scaleY(0.5) compresses it vertically.

Tips and Best Practices
  1. 1

    Scaling does not affect the element’s actual layout space — it only changes its visual rendering.

  2. 2

    Use transition or animation with transform for smooth scaling effects.

  3. 3

    Values less than 1 shrink the element, while values greater than 1 enlarge it.

  4. 4

    Combine scaling with rotate() or translate() for advanced motion effects.

Example: Animated Scaling on Hover

Here, the button smoothly enlarges when hovered using a transition applied to the scale transformation.